package com.tianya.portal.blog.controller;

import com.tianya.common.web.core.domain.AjaxResult;
import com.tianya.common.web.core.page.TableDataInfo;
import com.tianya.portal.blog.domain.BlogBookArchives;
import com.tianya.portal.blog.service.IBlogBookArchivesService;
import com.tianya.portal.common.core.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 文学档案 信息操作处理
 *
 * @author tianya
 * @date 2024-06-10
 */
@RestController
@RequestMapping("/bookArchives")
public class BlogBookArchivesController extends BaseController {

    @Autowired
    private IBlogBookArchivesService blogBookArchivesService;

    /**
     * 查询文学档案列表
     */
    @GetMapping("/list")
    @ResponseBody
    public TableDataInfo list(BlogBookArchives blogBookArchives) {
        startPage();
        List<BlogBookArchives> list = blogBookArchivesService.selectBlogBookArchivesList(blogBookArchives);
        return getDataTable(list);
    }

    /**
     * 查询文学档案数据
     */
    @GetMapping("/listData")
    @ResponseBody
    public AjaxResult listData(BlogBookArchives blogBookArchives) {
        List<BlogBookArchives> list = blogBookArchivesService.selectBlogBookArchivesList(blogBookArchives);
        return success(list);
    }


    /**
     * 获取文学档案详细信息
     */
    @GetMapping(value = "/detail/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(blogBookArchivesService.selectBlogBookArchivesById(id));
    }
}
